package com.wujieming.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wujieming.common.BaseController;
import com.wujieming.common.ResponseObject;
import com.wujieming.model.UserInfo;
import com.wujieming.service.UserInfoService;

@Controller
@RequestMapping("/user")
public class UserInfoController extends BaseController{
	
//	@Resource
//	UserInfoService userInfoService;
	@Resource(name = "userInfoService")
    UserInfoService userInfoService;
	/**
	 * 用户登录
	 * @param record
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/login")
	public @ResponseBody
	ResponseObject login(UserInfo record,HttpServletRequest request) {
		ResponseObject responseObject = initResponseObject();
		try{
			UserInfo userInfo = userInfoService.selectByPrimaryKey(1);
			System.out.println(userInfo.getUserName());
//			UserInfo userInfo = userInfoService.login(record);
//			if(ObjectUtil.isNotEmpty(userInfo)){
//				request.getSession().setAttribute("userInfo", userInfo);
//			}else{
//				
//			}
			responseObject.setDesc("登陆成功");
		}catch (Exception e) {
			log.error("error", e);
		}
		return responseObject;
	}
	
	

}
